<template>
  <section class="jumbotron">
    <h3 class="jumbotron-heading">Search Github Users</h3>
    <div>
        <input type="text" placeholder="enter the name you search" v-model="content"/>&nbsp;
        <button @click="searchnow">Search</button>
    </div>
  </section>
</template>

<script>
    import axios from 'axios'
    export default {
        name:'search',
        data(){
            return {
                content: ''
            }
        },
        methods:{
            searchnow(){
                console.log(this.content);
                axios.get(`https://api.github.com/search/users?q=${this.content}`).then(
                    response => {
                        console.log('success',response.data.items);
                        this.$bus.$emit('text',response.data.items)
                    },
                    error => {
                        console.log('error',error.message);
                    }
                )
            }
        }
    }
</script>

<style>

</style>